<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>mycss4</title>
    <style>
        .container {
            width: 1200px;
            background-color: lightgray;
            margin: 10px auto;  /*左右外边距设置为自动，则居中*/
        }
        .c1, .c2 {
            width: 600px;
            display: block;   /*转换为块级元素*/
        }
        .c1 {
            background-color: lightblue;
            float: left;
        }
        .c2 {
            background-color: lightcoral;
            float: left;
        }
    </style>
</head>
<body>
<div class="container">
    <span class="c1">left</span>
    <span class="c2">right</span>
</div>
</body>
</html>